package com.situ.day1;

import org.junit.Test;

public class HelloWorld {

    public static void main(String[] args) {
        //sout
        System.out.println("HelloWorld");
        // 类型 变量variable
        int age = 20;
        age = 23;
        //常量
        final int count = 23;
        //Cannot assign a value to final variable 'count'
        //count = 34;

        int $num5_ = 34;
    }

    @Test
    public void test1() {
        //soutm
        System.out.println("HelloWorld.test1");
        byte b1 = 127;
        //byte b2 = 128;
        byte b3 = -128;
        int i = 2111111111;
        double d = 3.14;

        char ch1 = 'a';
        char ch2 = 'b';
        char ch3 = ',';

        // if() {}    while() {}
        boolean bool1 = true;
        boolean bool2 = false;
    }

    @Test
    public void test2() {
        //byte->short(char)->int->long->float->double
        //soutm
        System.out.println("HelloWorld.test2");
        //Ctrl+D复制当前行到下一行
        System.out.println("HelloWorld.test2");
        //从小到大自动类型转换
        byte b = 23;
        int count = b;
        System.out.println("count: " + count);
        //从大到小需要强制类型转换，可能会丢失精度
        double d = 3.14;
        int num = (int)d;
        System.out.println("num: " + num);//3
    }

}
